#include<iostream>
using namespace std;
const int N = 1e5 + 10;
int a[N], b[N], c[N];
int f[N][4];
int n;
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i] >> b[i] >> c[i];
	}
	for (int i = 1; i <= n; i++) {
		//a[i]
		f[i][1] = max(f[i - 1][2], f[i - 1][3]) + a[i];
		//b[i]
		f[i][2] = max(f[i - 1][1], f[i - 1][3]) + b[i];
		//c[i]
		f[i][3] = max(f[i - 1][1], f[i - 1][2]) + c[i];
	}
	cout << max(f[n][1], max(f[n][2], f[n][3])) << endl;
	return 0;
}